package lianxi11;

import static lianxi11.Util.delay;
import static lianxi11.Util.format;
public class Discount {

	
	public enum Code{
		NODE(0),
		SILVER(5),
		GOLD(10),
		PLATINUM(15),
		DIAMOND(20);

		private final int percentage ;
		
		Code(int percentage){
			this.percentage =percentage;
		}
	}
	
	
	public static String applyDiscount(Quote quote){
		return quote.getShopName() +"price is "+ Discount.appy(quote.getPrice(), quote.getDiscountCode());
	}
	
	public static double appy(double price ,Code code ){
		delay();
		return format(price * (100 - code.percentage)/100);
	}
}
